<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">

    总计:{{sum}}<br/>
    {{sum>10?'总数大于10':'总数不大于10'}}<br/>
    <button type="button" @click="increase(2)">增加</button>

</div>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script type="text/javascript">
    new Vue({
        el:'#app',
        data:{
            sum:0  //总计
        },
        methods:{
            increase:function(s){

                alert(!undefined)
                this.sum+=s
            }
        }
    })
</script>
</body>
</html>